package world.snowcrystal.nova.controller;

import cn.hutool.core.lang.Snowflake;
import cn.hutool.core.util.IdUtil;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import world.snowcrystal.nova.common.BaseResponse;
import world.snowcrystal.nova.common.ResultUtils;

@RestController
@RequestMapping("/identifier")
public class IdentifierController {
    private static final Snowflake INSTANCE = IdUtil.getSnowflake(1, 1);

    @GetMapping("/snowflake")
    public BaseResponse<Long> getIdentifier() {
        return ResultUtils.success(INSTANCE.nextId());
    }
}
